import { CacheManager } from "../../manager/CacheManager";
import { EntityVo } from "./EntityVo";

export class PlayerVo extends EntityVo{
    private _hp:number = 100;
    public maxHp:number = 100;
    public hpRatio:number = 5;
    

    public init(){
        this._hp = 1000;
        this.maxHp = 1000;
        this.hpRatio = 5;
    }

    public set hp(val:number){
        if(this._hp <= 0) return;
        this._hp = Math.min(val,this.maxHp);
        if(this._hp <= 0) {
            CacheManager.game.gameOver();
        }
    }

    public get hp():number {
        return this._hp;
    }
}